using System;
using System.Xml.Serialization;
using System.Collections.Generic;

[XmlRoot("Accounts")]
public class Accounts
{
    public Accounts()
    {
        m_pCollection = new List<Account>();
    }

    [XmlElement("Account")]
    public List<Account> Collection
    {
        get { return m_pCollection; }
        set { m_pCollection = value; }
    }

    public List<Account> this[string usercode]
    {
        get
        {
            List<Account> accounts = new List<Account>();
            foreach(Account account in m_pCollection)
            {
                if (account.Usercode == usercode)
                {
                    accounts.Add(account);
                }
            }

            return accounts;
        }
    }

    private List<Account> m_pCollection;
}

/// <summary>
/// Account
/// </summary>
public class Account
{
    /************************************************************************/
    /*                          Constructor                                 */
    /************************************************************************/
    public Account()
    {

    }

    public Account(String usercode, String username, String password, String signature)
    {
        m_usercode = usercode;
        m_strUsername = username;
        m_strPassword = password;
        m_strSignature = signature;
    }

    /************************************************************************/
    /*                           Property                                   */
    /************************************************************************/
    [XmlElement("Symbol")]
    public String Usercode
    {
        get { return m_usercode; }
        set { m_usercode = value; }
    }

    [XmlElement("Username")]
    public String Username
    {
        get { return m_strUsername; }
        set { m_strUsername = value; }
    }

    [XmlElement("Password")]
    public String Password
    {
        get { return m_strPassword; }
        set { m_strPassword = value; }
    }

    [XmlElement("Signature")]
    public String Signature
    {
        get { return m_strSignature; }
        set { m_strSignature = value; }
    }

    [XmlElement("Selected")]
    public Boolean Selected
    {
        get
        {
            return m_bSelected;
        }
        set
        {
            m_bSelected = value;
        }
    }
    /************************************************************************/
    /*                        Private Member                                */
    /************************************************************************/
    private String m_usercode;
    private String m_strUsername;
    private String m_strPassword;
    private String m_strSignature;
    private Boolean m_bSelected;
}